<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <base href="/">
    <link rel="stylesheet" href="../static/layui/css/layui.css">
    <script src="../static/js/jquery-3.2.1.min.js"></script>
    <script src="../static/layui/layui.js"></script>
    <script>
        $(function () {
            $("#btnClose").on("click", function () {
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
            });
            layui.form.render();

            $("#save").on("click",function () {
                $.post({
                    url: "emp/create"
                    ,data: $("form").serialize()
                    ,success: function (result) {
                        if (result && result.success){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        }else {
                            layer.msg(result.message);
                        }
                    }
                })
            })
        });
    </script>
</head>
<body>
    <div align="center">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="name" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" value="0" autocomplete="off" placeholder="" checked class="layui-input">男
                    <input type="radio" name="sex" value="1" autocomplete="off" placeholder="" class="layui-input">女
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">年龄</label>
                <div class="layui-input-block">
                    <input type="text" name="age" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item model-form-footer" align="center">
                <!--<label class="layui-form-label"/></label>-->
                <button id="btnClose" class="layui-btn layui-btn-primary close" type="button">取消</button>
                <button class="layui-btn" lay-filter="userinfo-submit" lay-submit type="button" id="save">保存</button>
            </div>

        </form>
    </div>
</body>
</html>